package com.itheima.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;

public class TransAop {

    public void open(JoinPoint jp){
        //方法的全名带包结构
        //Signature name = jp.getSignature();
        //获得方法名
        String name = jp.getSignature().getName();
        //获得目标对象
        Object target = jp.getTarget();
        System.out.println("开启事务"+name+","+target);
    }

    public void commit(){
        System.out.println("提交事务");
    }

    public void close(){
        System.out.println("释放资源");
    }

    public void rollback(){
        System.out.println("回滚事务");
    }
}
